package com.itheima.easy.mapper;

import com.github.pagehelper.Page;
import com.itheima.easy.dto.MyRetreatDto;
import com.itheima.easy.dto.RetreatReqDto;
import com.itheima.easy.entity.PendingTasks;
import com.itheima.easy.entity.Retreat;
import com.itheima.easy.vo.DataScopeDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * @author sjqn
 * @date 2023/6/19
 */
@Mapper
public interface RetreatMapper {

    void createRetreat(Retreat retreat);

    @Select("select * from retreat where retreat_code = #{code}")
    Retreat getRetreatByCode(String code);

    @Update("update retreat set flow_status = #{flowStatus} where id = #{id} ")
    void updateRetreatByFlowStatus(@Param("id") long id, @Param("flowStatus") Integer flowStatus);

    @Update("update retreat set status = #{status} where id = #{id}")
    void updateStatus(@Param("id") Long id,@Param("status") Integer status);

    void update(Retreat retreat);

//    Page<List<Retreat>> selectByPage(@Param("retreatCode")String retreatCode, @Param("name")String name, @Param("idCardNo")String idCardNo, @Param("startTime")LocalDateTime startTime, @Param("endTime")LocalDateTime endTime, @Param("pageNum")Integer pageNum, @Param("pageSize") Integer pageSize, @Param("applicatId") Long applicatId, @Param("deptNo") String deptNo, @Param("sqlDataScope") String sqlDataScope);
    Page<List<Retreat>> selectByPage(RetreatReqDto retreatReqDto);

    @Select("select * from retreat where elder_id = #{elderId} and status = 1")
    Retreat selectByElderId(Long elderId);
}
